package net.zoneland.zrdp.biz.mapstruct;

import net.zoneland.uniflow.client.TaskQueryParam;
import net.zoneland.zrdp.biz.domain.FlowApproveInfo;
import net.zoneland.zrdp.biz.domain.pojo.form.CreateReadsForm;
import net.zoneland.zrdp.biz.domain.pojo.form.StartProcessForm;
import net.zoneland.zrdp.biz.domain.pojo.form.TaskProcessForm;
import net.zoneland.zrdp.biz.domain.pojo.query.TaskQuery;
import net.zoneland.zrdp.framework.web.domain.uniflow.CompleteTaskParam;
import net.zoneland.zrdp.framework.web.domain.uniflow.CreateReadsParam;
import net.zoneland.zrdp.framework.web.domain.uniflow.StartProcessParam;
import org.mapstruct.*;
import org.mapstruct.factory.Mappers;


/**
 * 流程处理.
 *
 * @version v1.0
 */
@Mapper
public interface FlowProcessConverter {

    FlowProcessConverter INSTANCE = Mappers.getMapper(FlowProcessConverter.class);

    /** 流程启动参数对象转换. **/
    StartProcessParam formToStartProcess(final StartProcessForm userInfoForm);

    /** 任务查询参数对象转换. **/
    TaskQueryParam formToTaskQueryParam(final TaskQuery taskQueryForm);

    /** 任务处理参数对象转换. **/
    CompleteTaskParam formToCompleteTask(final TaskProcessForm userInfoForm);

    /** 创建待阅参数对象转换. **/
    @Mapping(target = "node", source = "sysNodeId")
    CreateReadsParam formToCreateReads(final CreateReadsForm userInfoForm);


    /** 任务处理参数对象转审批记录对象. **/
    @Mapping(target = "nodeId", source = "sysNodeId")
    @Mapping(target = "nodeName", source = "sysNodeName")
    @Mapping(target = "nextNodeId", source = "nextNode")
    @Mapping(target = "decisionName", source = "option")
    FlowApproveInfo formToFlowApproveInfo(final TaskProcessForm taskProcessForm);


}
